﻿// Picturez
//
// Copyright © Frank Nagl, 2008-2012
// admin@franknagl.de
// www.franknagl.de
//
namespace Picturez
{
    using System.Windows.Forms;

    partial class MainForm
    {
        private void BiggestLengthKryptonTextBoxKeyUp(object sender, KeyEventArgs e)
        {
            if (int.TryParse(
                    BiggestLengthKryptonTextBox.Text, out Current.BiggestLength)
                && Current.BiggestLength >= 1)
            {
                return;
            }
            Current.BiggestLength = 1280;
            BiggestLengthKryptonTextBox.Text = "1280";
        }

        private void HeightKryptonTextBoxKeyUp(object sender, KeyEventArgs e)
        {
            if (!int.TryParse(HeightKryptonTextBox.Text, out Current.Height) ||
                Current.Height < 1)
            {
                Current.Height = 800;
                HeightKryptonTextBox.Text = "800";
            }
        }

        private void QualityKryptonTextBoxKeyUp(object sender, KeyEventArgs e)
        {
            if (byte.TryParse(QualityKryptonTextBox.Text, out Current.JpgQuality) &&
                Current.JpgQuality <= 100 &&
                Current.JpgQuality >= 1)
            {
                QualityTrackBar.Value = Current.JpgQuality;
            }
            else
            {
                QualityTrackBar.Value = 100;
                Current.JpgQuality = 100;
                QualityKryptonTextBox.Text = "100";
            }
        }

        private void WidthKryptonTextBoxKeyUp(object sender, KeyEventArgs e)
        {
            if (!int.TryParse(WidthKryptonTextBox.Text, out Current.Width) ||
                Current.Width < 1)
            {
                Current.Width = 1280;
                WidthKryptonTextBox.Text = "1280";
            }
        }
    }
}
